package com.dao;

import com.entity.CaipinfenleiEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Set;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;

import com.entity.CaipinxinxiEntity;
import com.entity.MenuEntity;
import org.apache.ibatis.annotations.*;
import com.entity.vo.CaipinfenleiVO;
import com.entity.view.CaipinfenleiView;


/**
 * 菜品分类
 * 
 * @author 
 * @email 
 * @date 2021-03-20 21:35:40
 */
@Mapper
public interface CaipinfenleiDao extends BaseMapper<CaipinfenleiEntity> {
	
	List<CaipinfenleiVO> selectListVO(@Param("ew") Wrapper<CaipinfenleiEntity> wrapper);
	
	CaipinfenleiVO selectVO(@Param("ew") Wrapper<CaipinfenleiEntity> wrapper);
	
	List<CaipinfenleiView> selectListView(@Param("ew") Wrapper<CaipinfenleiEntity> wrapper);

	List<CaipinfenleiView> selectListView(Pagination page,@Param("ew") Wrapper<CaipinfenleiEntity> wrapper);
	
	CaipinfenleiView selectView(@Param("ew") Wrapper<CaipinfenleiEntity> wrapper);

	@Options(useGeneratedKeys = true, keyProperty = "id")
	@Insert("insert into menu (menu_name) values (#{menu.menuName})")
    void addMenu(MenuEntity menu);

	@Insert("insert into menu_caipin (menu_id,caipin_id) values (#{menuId},#{caipinId})")
	void addMenuAndCaipin(Integer menuId, Integer caipinId);

	@Select("select * from caipinxinxi")
	Set<CaipinxinxiEntity> getCaipin();

	@Select("select * from menu")
	Set<MenuEntity> getMenuList();

	@Select("select caipinId from menu_caipin where menu_id = #{id}")
	List<Integer> getCaipinIdByMenuId(Integer id);

	@Select("select * from caipinxinxi where id = caipinId")
	CaipinxinxiEntity getCaipinxinxiById(Integer caipinId);
}
